﻿using AutoMapper;
using DictionaryWebApp.DTO;
using DictionaryWebApp.EF_Models;
using System.Collections.Generic;

namespace DictionaryWebApp.App_Start
{
    public class AutoMapperConfig
    {
        public static void RegisterMappings()
        {
            Mapper.CreateMap<NewWordViewModel, Word>()
                    .ForMember(w => w.Description, ww => ww.MapFrom(f => f.Description))
                    .ForMember(w => w.ForeignWord, ww => ww.MapFrom(f => f.ForeignWord))
                    .ForMember(w => w.Transcription, ww => ww.MapFrom(f => f.Transcription))
                    .ForMember(w => w.Translation, ww => ww.MapFrom(f => f.Translation))
                    .ForMember(w => w.UserID, ww => ww.MapFrom(f => f.UserID))
                    .ForMember(w => w.WordID, ww => ww.MapFrom(f => f.WordID));

            Mapper.CreateMap<Word, IndexWordViewModel>()
                    .ForMember(w => w.Description, ww => ww.MapFrom(f => f.Description))
                    .ForMember(w => w.ForeignWord, ww => ww.MapFrom(f => f.ForeignWord))
                    .ForMember(w => w.Transcription, ww => ww.MapFrom(f => f.Transcription))
                    .ForMember(w => w.Translation, ww => ww.MapFrom(f => f.Translation))
                    .ForMember(w => w.WordID, ww => ww.MapFrom(f => f.WordID));
        }
    }
}